import 'dart:convert';

import 'package:eplorex/providers/user_context.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'local_shared_cache.dart';

class AuthProvider extends ChangeNotifier {
  Future<bool> isLoggedIn() async {
    String? authorization = await LocalSharedCache.getString("loginUid");
    if (authorization != null) {
      UserContext cachedUserCxt =
          UserContext.fromJson(jsonDecode(authorization!));
      return cachedUserCxt != null;
    }
    return false;
  }
}
